/*
 * ttbqt - A teletekst browser
 * http://code.google.com/p/ttbqt
 * Copyright (C) 2011, Kevin van der Vlist
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include "Teletext.h"
#include "RTVOostTeletext.h"

#include <QtDebug>

const QString RTVOostTeletext::TEXTNAME("RTVOostTeletext");

/**
 * \short Constructor of the base Teletext object. 
 * 
 * Constructor of the base Teletext object. 
 */

RTVOostTeletext::RTVOostTeletext(PageInfo *p) : Teletext(p) {
  channelname = RTVOostTeletext::TEXTNAME;
}

/**
 * \short Destructor of the base Teletext object. 
 * 
 * Destructor of the base Teletext object. 
 */

RTVOostTeletext::~RTVOostTeletext() {

}

/**
 * Return a pixmap to the current page
 */

void RTVOostTeletext::getTextPage(int page, int subpage) {
  QString url;

  if(subpage == 1) {
    url.sprintf("http://www.rtvoost.nl/teletekst/teletekst/%d.png", page);
  } else {
    url.sprintf("http://www.rtvoost.nl/teletekst/teletekst/%dS%02d.png", page, subpage-1);
  }

  QNetworkRequest request;
  request.setUrl(QUrl(url));
  request.setRawHeader("User-Agent", USER_AGENT);
  reply = qnam->get(request);
}
